// base
import Taro, { Component } from '@tarojs/taro'
import { View, Swiper, SwiperItem, Image } from '@tarojs/components'
import { dealImgUrl } from '../../../../configuration/staticimg'
// less
import './index.less'

class SwiperVertical extends Component {
  static defaultProps = {
    dataSource: []
  }
  componentWillMount () {
    // onLoad
  }

  componentDidMount () {
    // onready
  }

  componentDidShow () {
    // onshow
  }

  componentDidHide () {
    // onhide
  }

  componentWillUnmount () {
    // onUnload
  }

  delay (time = 0) {
    return new Promise(resolve => {
      setTimeout(() => {
        resolve()
      }, time)
    })
  }

  render () {
    console.log(this.props.dataSource, 'this.props.dataSource')
    return (
      <View className="SwiperVertical_id17201">
        <Swiper
          className="swiperver"
          indicatorColor="rgba(255,255,255,.3)"
          indicatorActiveColor="rgba(255,255,255,1)"
          vertical
          circular
          indicatorDots
          autoplay
        >
          {this.props.dataSource.map((data, index) => {
            return (
              <SwiperItem key={index}>
                <Image src={dealImgUrl(data.url)} mode="aspectFill" className="imagewrap" />
              </SwiperItem>
            )
          })}
        </Swiper>
        <View className="absbt" />
      </View>
    )
  }
}

export default SwiperVertical
